#include<bits/stdc++.h>
using namespace std;
#define N 3030
#define P 998244353
typedef long long LL;

LL f[N][N];
LL a,b,c,d;

int main(){
    cin>>a>>b>>c>>d;
    f[0][0] = 1;
    int n = c - a, m = d - b;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= m; j++){
            if(i == 0 && j == 0) continue;
            f[i][j] = 0;
            if(i) f[i][j] += f[i - 1][j] * (j + b) % P;
            if(j) f[i][j] += f[i][j - 1] * (i + a) % P;
            if(i * j) f[i][j] -= f[i - 1][j - 1] * (a + i - 1) % P * (b + j - 1) % P;
            f[i][j] = (f[i][j] % P + P) % P;
        }
    }
    printf("%lld\n", f[n][m]);
    return 0;

}